package top.tagao.m01_structuralPatterns.s_02_adapter.adapters;

import top.tagao.m01_structuralPatterns.s_02_adapter.round.RoundPeg;
import top.tagao.m01_structuralPatterns.s_02_adapter.square.SquarePeg;

/**
 * @author fu-xiao-liu
 * @Date 2022/7/25 23:26
 */
public class SquarePegAdapter extends RoundPeg {
    private SquarePeg peg;

    public SquarePegAdapter(SquarePeg peg) {
        this.peg = peg;
    }

    @Override
    public double getRadius() {
        double  result;
        result = (Math.sqrt(Math.pow((peg.getWidth() / 2), 2) * 2)) ;
        System.out.println((Math.sqrt(Math.pow((peg.getWidth() / 2), 2) * 2)));
        System.out.println((Math.sqrt(Math.pow((peg.getWidth() ), 2) * 2))/2);
        return result;
    }
}
